[C#] LINQ Group By


Feb 10, 2023

In some scenarios, we would like to select each first one row
of the group which we group by personId.

The following code block is a simple example.

var memberList =
    memberSourceData.GroupBy(item => item.personId)
        .Select(chunck => chunck
            .OrderByDescending(c => c.Id)
            .First())
        .ToList();
#C#






你可能感興趣的文章

AI輔導室|製作黑洞效果

AI輔導室|製作黑洞效果

000|AskYou3000 提問清單

000|AskYou3000 提問清單

[Html]如何將Svg圖檔放到信件中(Outlook)

[Html]如何將Svg圖檔放到信件中(Outlook)






留言討論






2
2
2